<?php
namespace App\Http\Requests\User;

use App\Http\Requests\Request;
use Illuminate\Validation\Rule;

/**
 * 补填用户信息
 *
 * @package App\Http\Requests\User
 * @author zx
 * @date 2018-11-23
 */
class AddinfoRequest extends Request {

    public function rules():array
    {
        return [
            'uid' => 'required|numeric',
            "nickname" => 'min:1|max:10',
            'password' => 'between:6,18|alpha_num',
            'image' => 'url',
            'prov' => 'numeric',
            'city' => 'numeric',
            'area' => 'numeric',
            'sex' => Rule::in([0,1]),
            'lon' => 'numeric',
            'lat' => 'numeric'
        ];
    }

    public function messages():array
    {
        return [
            'uid.required' => '用户标识字段必须',
            'nickname.min' => '昵称不可少于1个字符',
            'nickname.max' => '昵称不可大于10个字符',
            'password.between' => '密码不可少于6位字符大于18位字符',
            'password.alpha_num' => '密码必须为数字字母下划线',
            'image.url' => '无效的地址',
            'prov' => '省份格式错误',
            'city' => '市格式错误',
            'area' => '区格式错误',
            'sex.in' => '性别范围错误',
            'lon.numeric' => '经纬度格式错误',
            'lat.numeric' => '经纬度格式错误'
        ]; // TODO: Change the autogenerated stub
    }

}